﻿/**HTML页面无法获取request对象，可以用此ctx替换${ctx}**/
var ctx=getRootPath();
/**
 * 获取项目根路径
 */
function getRootPath(){
	var path=__CreateJSPath("boot.js");
    var ss = path.split("/");
    ss.length =4;
// springboot因为配置问题，不需要加项目名称即可访问
// ss.length =3;
    var url_ = ss.join("/");;
	return url_;
}

function __CreateJSPath(js) {
    var scripts = document.getElementsByTagName("script");
    var path = "";
    for (var i = 0, l = scripts.length; i < l; i++) {
        var src = scripts[i].src;
        if (src.indexOf(js) != -1) {
            var ss = src.split(js);
            path = ss[0];
            break;
        }
    }
    var href = location.href;
    href = href.split("#")[0];
    href = href.split("?")[0];
    var ss = href.split("/");
    ss.length = ss.length - 1;
    href = ss.join("/");
    if (path.indexOf("https:") == -1 && path.indexOf("http:") == -1 && path.indexOf("file:") == -1 && path.indexOf("\/") != 0) {
        path = href + "/" + path;
    }
    return path;
}


console.log(ctx)
document.write('<script src="' + ctx + '/trunk/js/jquery-1.9.1.min.js" type="text/javascript"></sc'+'ript>');
document.write('<script src="' + ctx + '/trunk/js/miniui/miniui.js" type="text/javascript" ></sc'+'ript>');
document.write('<script src="' + ctx + '/trunk/js/mes/mes.js" type="text/javascript"></sc'+'ript>');
/*换肤必须要字体库*/
document.write('<link href="' + ctx + '/trunk/js/miniui/res/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />');
document.write('<link href="' + ctx + '/trunk/js/miniui/themes/default/miniui.css" rel="stylesheet" type="text/css" />');
document.write('<link href="' + ctx + '/trunk/js/miniui/themes/metro-gray/skin.css" rel="stylesheet" type="text/css" />');
document.write('<link href="' + ctx + '/trunk/js/miniui/themes/default/medium-mode.css" rel="stylesheet" type="text/css" />');
document.write('<link href="' + ctx + '/trunk/js/miniui/themes/icons.css" rel="stylesheet" type="text/css" />');
document.write('<link href="' + ctx + '/trunk/css/base.css" rel="stylesheet" type="text/css" />');
if(top.location.href.indexOf("frame-top1.jsp")!=-1||
		top.location.href.indexOf("frame-left1.jsp")!=-1){
	document.write('<link href="' + ctx + '/trunk/css/frame/style1/UI.css" rel="stylesheet" type="text/css" />');
}else{
	document.write('<link href="' + ctx + '/trunk/css/frame/style2/UI.css" rel="stylesheet" type="text/css" />');
}





